﻿using System.Collections.Generic;
using System.Data;
using Core.Library;

namespace DataObject.Adv
{
    public class AdvController
    {
        /***************************************
        = Back End
        -------------------------------------- */
        public static void Adv_Create(AdvObject o)
        {
            AdvDAL.Adv_Create(o);
        }

        public static void Adv_Update_Url(int advId, string url)
        {
            AdvDAL.Adv_Update_Url(advId, url);
        }

        public static void Adv_Delete(int advId)
        {
            AdvDAL.Adv_Delete(advId);
        }

        public static void Adv_DeleteByType(int typeId)
        {
            AdvDAL.Adv_DeleteByType(typeId);
        }

        public static AdvObject Adv_GetById(int advId)
        {
            return ObjectHelper.FillObject<AdvObject>(AdvDAL.Adv_GetById(advId));
        }

        /***************************************
        = Front End
        -------------------------------------- */
        public static List<AdvObject> Adv_GetPartner()
        {
            return ObjectHelper.FillCollection<AdvObject>(AdvDAL.Adv_GetListByTypeId((int)AdvType.Partner));
        }

        public static List<AdvObject> Adv_GetAdvSlideShow()
        {
            return ObjectHelper.FillCollection<AdvObject>(AdvDAL.Adv_GetListByTypeId((int)AdvType.SlideShow));
        }

        public static List<AdvObject> Adv_GetAdvMultiple()
        {
            return ObjectHelper.FillCollection<AdvObject>(AdvDAL.Adv_GetListByTypeId((int)AdvType.Multiple));
        }

        public static AdvObject Adv_GetAdvSingle()
        {
            return ObjectHelper.FillObject<AdvObject>(AdvDAL.Adv_GetListByTypeId((int)AdvType.Single));
        }
    }
}
